﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UserControls_uc_Location : System.Web.UI.UserControl
{
    // Fields
    private string height;
    private string location;
    public string pic;
    private string type;
    private string width;

    // Methods
    public void GetLocation()
    {
        Maticsoft.BLL.Location location = new Maticsoft.BLL.Location();
        Maticsoft.Model.Location location2 = new Maticsoft.Model.Location();
        location2 = location.Getlocation(Convert.ToInt32(this.location));
        if (location2 == null)
        {
            this.pic = "";
        }
        else if (location2.visibility == 0)
        {
            this.pic = "";
        }
        else if (location2.image != "")
        {
            if (location2.type == 0)
            {
                this.pic = this.pic + "<a href='" + location2.pageurl + "'  target='_blank'><img src='" + location2.image + "' ></a>";
            }
            else if (location2.type == 1)
            {
                if ((location2.pageurl != "") || (location2.pageurl != null))
                {
                    this.pic = this.pic + "<embed src='" + location2.pageurl + "' quality='high'  align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash'></embed>";
                }
                else
                {
                    this.pic = this.pic + "<embed src='" + location2.image + "' quality='high'  align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash'></embed>";
                }
            }
        }
        else
        {
            this.pic = this.pic + location2.locationname;
        }
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        if (!this.Page.IsPostBack)
        {
            this.GetLocation();
        }
    }

    // Properties
    public string Height
    {
        get
        {
            return this.height;
        }
        set
        {
            this.height = value;
        }
    }

    public string Location
    {
        get
        {
            return this.location;
        }
        set
        {
            this.location = value;
        }
    }

    public string Type
    {
        get
        {
            return this.type;
        }
        set
        {
            this.type = value;
        }
    }

    public string Width
    {
        get
        {
            return this.width;
        }
        set
        {
            this.width = value;
        }
    }

}